package com.daos;

import java.io.Serializable;

import javax.inject.Inject;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;


@Repository
public abstract class AbstractDao <E> implements Serializable {

	protected HibernateTemplate hibernateTemplate;

	@Inject
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.hibernateTemplate = new HibernateTemplate(sessionFactory);
	}
	public void save(E e) {
		hibernateTemplate.saveOrUpdate(e);
	}
	
	public void remove(E e) {
		hibernateTemplate.delete(e);
	}
	
}
